<?php

/**
 * main actions.
 *
 * @package    question_answer
 * @subpackage main
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class mainActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
	$this->form = new sfGuardUserForm();  
   
  }

  public function executeRegister(sfWebRequest $request)
  {
    /*if ($this->getUser()->isAuthenticated())
    {
      $this->redirect('@homepage');
    }*/
	
    $this->form = new sfGuardUserForm();
    if ($request->getMethod() == 'POST')
    {
      $this->form->bind($request->getParameter($this->form->getName()));
      if ($this->form->isValid())
      {
        $user = $this->form->save();
        $this->getUser()->signIn($user);
        $this->redirect('@homepage');
      }
    }
  }

}
